package log.entity;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "log_service")
public class LogForService {
	private String id;
	private String fullClassName;
	private int useTime = 0;
	private Boolean isError = false;
	private String exceptionName;
	private Date date = new Date();

	public LogForService() {

	}

	public LogForService(String fullClassName, int useTime, Boolean isError, String exceptionName) {
		this.fullClassName = fullClassName;
		this.useTime = useTime;
		this.isError = isError;
		this.exceptionName = exceptionName;
	}

	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "ID", unique = true, nullable = false, length = 32)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "fullClassName", length = 200)
	public String getFullClassName() {
		return fullClassName;
	}

	public void setFullClassName(String fullClassName) {
		this.fullClassName = fullClassName;
	}

	@Column(name = "useTime")
	public int getUseTime() {
		return useTime;
	}

	public void setUseTime(int useTime) {
		this.useTime = useTime;
	}

	@Column(name = "isError")
	public Boolean getIsError() {
		return isError;
	}

	public void setIsError(Boolean isError) {
		this.isError = isError;
	}

	@Column(name = "exceptionName", length = 200)
	public String getExceptionName() {
		return exceptionName;
	}

	public void setExceptionName(String exceptionName) {
		this.exceptionName = exceptionName;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "date")
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@Override
	public String toString() {
		return "LogForService [fullClassName=" + fullClassName + ", useTime=" + useTime + ", isError=" + isError
				+ ", exceptionName=" + exceptionName + ", date=" + date + "]";
	}
	
	
}
